# 主应用文件
from flask import Flask
from flask_cors import CORS
from models.database import init_db
from controller.user import user_bp
from controller.address import address_bp
from controller.technician import technician_bp
from controller.repair_order import order_bp
from controller.admin import admin_bp
from controller.repair_price import repair_price_bp

# 创建Flask应用
app = Flask(__name__)

# 配置跨域
CORS(app, resources={r"/api/*": {"origins": "*"}})

# 初始化数据库
init_db(app)

# 注册蓝图
app.register_blueprint(user_bp)
app.register_blueprint(address_bp)
app.register_blueprint(technician_bp)
app.register_blueprint(order_bp)
app.register_blueprint(admin_bp)
app.register_blueprint(repair_price_bp)

# 启动应用
if __name__ == '__main__':
    app.run(debug=True,host='0.0.0.0')